import { Flow } from '@leafer-in/flow'
import { Box, Text } from 'leafer-ui'

export const generateNeicunItem = (
    addr: string,
    value: string,
    bg: string = '#fff'
) => {
    const addrWidth = addr.length * 16
    const flow = new Flow({
        x: 0,
        y: 0,
        flow: 'x',
        children: [
            new Text({
                text: addr,
                width: addrWidth,
                height: 24,
                fontSize: 20,
                fontFamily: '宋体',
                padding: [0, 10, 0, 10],
                verticalAlign: 'middle',
            }),
            new Box({
                fill: bg,
                stroke: '#000',
                strokeAlign: 'center',
                children: [
                    new Text({
                        text: value,
                        fontSize: 20,
                        fontFamily: '宋体',
                        width: 200,
                        height: 24,
                        padding: [0, 10, 0, 10],
                        verticalAlign: 'middle',
                    }),
                ],
            }),
        ],
    })
    return flow
}
